home *** CD-ROM | disk | FTP | other *** search
/ DC Comics: Essential Coll…ditions & Graphic Novels / DC Comics: Essential Collected Editions & Graphic Novels.iso / pc / scripts / link_scripts.js < prev   
Encoding:
JavaScript  |  2004-04-27  |  3.3 KB  |  112 lines

  1.  
  2.  
  3. /*
  4.  * Function popUpPage() opens an html file in a 
  5.  * new browser window and centers the window on the user's computer screen.
  6.  * This function is passed to it:
  7.  * path - the URL of the HTML page to open.
  8.  * name - the name to give the browser window.
  9.  * scroll - the option of scroll bars on the browser window, yes or no.
  10. */
  11.  
  12. function popUpPage(path, name, scroll) {
  13.     var w = (520);  // if width not given, define width of the popup page.
  14.     var h = (725);  // if height not given, definte height of the popup page.
  15.     var win2X = (screen.width/2 - w/2); // Center popup page offset by it's width.
  16.     var win2Y = 15; // Top of the popup page on the screen.
  17.     winprops2 = 'height='+h+',width='+w+',top='+win2Y+',left='+win2X+',scrollbars='+scroll+',resizable'// properties of the browser window.
  18.     win2 = window.open(path, name, winprops2) // Opens the new browser window.
  19.     if (parseInt(navigator.appVersion) >= 4) { win2.window.focus(); } // Give the new browser widow focus.
  20. }
  21.  
  22.  
  23. //------------------------------
  24.  
  25. /*
  26.  * Function MM_jumpMenu() opens a new web page in a specified window.
  27.  * It is used by selecting an option on the drop down navigation forms.
  28.  * This function is passed to it:
  29.  * targ - window location (i.e.: this, _blank, _parent, etc)
  30.  * selObj - name of the selection object that holds the options
  31.  * restore - if true, dropdown menu will reset to original state after selection is made
  32.  */
  33.  
  34. function MM_jumpMenu(targ,selObj,restore){ //v3.0
  35.   eval(targ+".location='" + selObj.options[selObj.selectedIndex].value + "'");
  36.   if (restore) { selObj.selectedIndex=0; }
  37. }
  38.  
  39.  
  40. //------------------------------
  41.  
  42.  
  43. /*
  44.  * Function update_frame() opens a new web page in the current browser widow.
  45.  * It is used by selecting an option on the drop down navigation forms.
  46.  * This function is passed to it:
  47.  * myoptions - object containing the URL of the HTML page to open.
  48.  */
  49.  
  50. function update_frame(myoptions) {
  51.     destination=myoptions[myoptions.selectedIndex].value;
  52.     if(destination=="null"){
  53.         return true; 
  54.     }
  55.     window.open(destination, '_self'); // Opens the new browser window.
  56.     myoptions.selectedIndex=0; 
  57.     return true;
  58. }
  59.  
  60. //------------------------------
  61.  
  62.  
  63. /*
  64.  * Function myVoid() does nothing.  It is used when the anchor tag has an event
  65.  * such as OnMouseOver that uses a function.  We want the function to be called
  66.  * rather than the URL in the anchor tag called.
  67.  */
  68.  
  69. function myVoid(){}
  70.  
  71.  
  72. //------------------------------
  73.  
  74. function FeatureWindow(mypage, myname, w, h, scroll) {
  75. var winl = 0;
  76. var wint = 0;
  77. winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''
  78. win = window.open(mypage, myname, winprops)
  79. if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  80. }
  81.  
  82.  
  83. //------------------------------
  84.  
  85.  
  86. // This funciton verifies the zip code when the comic form is submitted.         
  87. function ValidateZip()
  88. {
  89.  
  90.   if (document.search.Zip.value == "")
  91.   {
  92.     alert("Please enter a value for the \"Zip\" field.");
  93.     document.search.Zip.focus();
  94.     return (false);
  95.   }
  96.  
  97.   if (document.search.Zip.value.length < 5)
  98.   {
  99.     alert("Please enter at least 5 characters in the \"Zip\" field.");
  100.     document.search.Zip.focus();
  101.     return (false);
  102.   }
  103.  
  104.   if (document.search.Zip.value.length > 7)
  105.   {
  106.     alert("Please enter at most 7 characters in the \"Zip\" field.");
  107.     document.search.Zip.focus();
  108.     return (false);
  109.   }
  110.   return (true);
  111. }
  112.